<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>class的set-get</title>
</head>
<body>
    <script>
        // get  set
        class Phone {
            get price () {
                console.log(`价格属性被读取了`);
                return `i love you`;
            }

            set price (newVal) {
                console.log(`价格属性被修改了`);
            }
        }

        // 实例化对象
        let p = new Phone();
        console.log(p.price);
        p.price = `free`
    </script>
</body>
</html>